/*
2021-10-17
https://leetcode-cn.com/problems/count-number-of-maximum-bitwise-or-subsets/
*/ 
class Solution {
public:
    int countMaxOrSubsets(vector<int>& nums) {
        int n=nums.size();
        int sum=0;
        for(int i=0;i<n;i++)
            sum|=nums[i];
        int ans=0;
        for(int i=1;i<(1<<n);i++)
        {
            int temp=0;
            for(int j=0;j<n;j++)
            {
                if(i>>j & 1) temp|=nums[j];
            }
            if(temp==sum) ans++;
        }
        return ans;
    }
};

